<%--
  Created by IntelliJ IDEA.
  User: zyj
  Date: 2021/12/25
  Time: 22:31
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>

  <!-- 引入谷歌库 -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:300,700">

  <!-- 引入font awesome图标库 -->
  <script src="https://kit.fontawesome.com/2449e59251.js" crossorigin="anonymous"></script>

  <!-- 引入Bootstrap3.3.0 -->
  <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">

  <!-- 引入layui css -->
  <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" />

  <!-- 引入本地css文件 -->
  <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/administrator.css">

  <!-- 引入jquery -->
  <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>

  <!-- 引入bootstrap.js -->
  <script src="http://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

  <!-- 引入 layui.js -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/layui/2.6.8/layui.min.js"></script>

  <meta charset="utf-8">
  <title>管理员登录</title>
</head>
<body style="background: #FFFFFF;">

<div class="c-title">
  <p class="title-text">管理员登录</p>
</div>

<div class="c-login">
  <form class="loginForm layui-form">
    <div class="layui-form-item">
      <input type="text" name="private_key" class="layui-input" placeholder="请输入管理员密钥" required lay-verify="required|private_key" />
    </div>
    <div class="layui-form-item">
      <button class="layui-btn btn_orange" lay-submit lay-filter="administratorLoginBtn">登录</button>
    </div>
  </form>
</div>

<script>

  var PRIVATE_KEY = "imms2021";

  layui.use('form', function(){
    var form = layui.form;

    // 监听数据
    form.verify({
      private_key: function(value, item) {
        // alert(value);

        if (PRIVATE_KEY === value) {
          //  密钥正确
          window.open("${pageContext.request.contextPath}/admin/allUser");
        } else {
          return "密钥不正确";
        }
      }
    });

  });

</script>

</body>
</html>
